import request from '@/utils/request'

export function getOrderList(params) {
  return request({
    url: '/api/api/admin/orders',
    method: 'get',
    params
  })
}

export function getOrderDetail(orderNo) {
  return request({
    url: `/api/api/admin/orders/${orderNo}`,
    method: 'get'
  })
}

export function shipOrder(data) {
  return request({
    url: '/api/admin/orders/ship',
    method: 'get',
    data
  })
}

export function cancelOrder(orderNo) {
  return request({
    url: `/api/api/admin/deleteOrder/${orderNo}`,
    method: 'get',
  })
}

export function confirmOrder(orderNo) {
  return request({
    url: `/api/admin/orders/${orderNo}/confirm`,
    method: 'post',
  })
}

// 获取用户订单
export function getOrders(userId) {
  return request({
    url: `/api/orders/${userId}`,
    method: 'get',
  });
}

// 创建订单
export function createOrder(data) {
  return request({
    url: '/api/orders',
    method: 'post',
    data,
  });
}

// 获取订单详情
export function getOrderDetail(orderId) {
  return request({
    url: `/api/orders/${orderId}`,
    method: 'get',
  });
}
